package test0109;

import java.io.*;

public class Test04 {
    public static void main(String[] args) throws IOException {
        // (4)把d盘下的文件拷贝到e盘下
         copy("d:/a.txt","d:/b.txt");
    }

    private static void copy(String s, String s1) throws IOException {//创建文件输入流
        FileReader fileReader = new FileReader(s);
        BufferedReader bufferedReader = new BufferedReader(fileReader);
        FileWriter fileWriter = new FileWriter(s1,true);
        BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);

        String str = "";
        while ((str = bufferedReader.readLine()) != null) {
            bufferedWriter.write(str);

        }
        bufferedReader.close();
        fileReader.close();
        bufferedWriter.close();
        fileWriter.close();
    }
}
